package com.zc.mychart.model;

import android.util.Log;

import androidx.annotation.NonNull;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

public class GoodsAllBean implements Serializable {
    public String pro_code;//合约code
    public String pro_name;//合约名
    public double latest_price;//最新价
    public double price_beginning;//开盘价
    public double price_end_lastday;//昨收
    public double high_price;//最高
    public double lowwest_price;//最低
    public String update_time;//价格更新时间
    public List<GoodsItemBean> goods_list;//具体商品
    public String unit;//单位
    public String unit_cn;//单位中文
    public int during_type;//1开市0休市
    public int multiple;//换算比例值

    public GoodsItemBean getGoodsItemBean(int j) {

        return goods_list.get(j);
    }

    @Override
    public boolean equals(Object o) {
        Log.d("dangzt", "进入equals方法");
        if (o == null) return false;
        if (o instanceof GoodsAllBean){
            GoodsAllBean product = (GoodsAllBean) o;
            Log.d("dangzt", latest_price + "equals: " + product.latest_price);
            return latest_price == product.latest_price;
//            return Double.compare(product.latest_price, latest_price) == 0;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(latest_price);
    }

    @NonNull
    @Override
    public String toString() {
        return "最新价格" + latest_price;
    }
}
